home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
dax1.exe
/
DAP
/
DAP015.C
< prev
next >
Wrap
Text File
|
1992-07-15
|
4KB
|
108 lines
// ╔════════════════════════════════════════════════════════════════════╗
// ║ ║
// ║ module: dap015.c ║
// ║ abstract: This module contains DAP request 1015 ║
// ║ ║
// ║ environment: NetWare 3.x v3.11 ║
// ║ Network C for NLMs SDK ║
// ║ CLib v3.11 ║
// ║ Network C for DOS v2.0 ║
// ║ NetWare C Interface DOS v1.2 ║
// ║ ║
// ║ This software is provided as is and carries no warranty ║
// ║ whatsoever. Novell disclaims and excludes any and all implied ║
// ║ warranties of merchantability, title and fitness for a particular ║
// ║ purpose. Novell does not warrant that the software will satisfy ║
// ║ your requirements or that the software is without defect or error ║
// ║ or that operation of the software will be uninterrupted. You are ║
// ║ using the software at your risk. The software is not a product ║
// ║ of Novell, Inc. or any of subsidiaries. ║
// ║ ║
// ╟────────────────────────────────────────────────────────────────────╢
// ║ maintenance history: ║
// ║ level date pi description ║
// ╟────────────────────────────────────────────────────────────────────╢
// ║ 001 02/21/92 kl initial release. ║
// ╚════════════════════════════════════════════════════════════════════╝
#include "dap/dapsys.h"
//
// The following are the request/reply structures for the divOperands
// DAP.
//
typedef struct{ // div operands request pkt
SINT32 operand1; // operand1
SINT32 operand2; // operand2
}DORequest;
typedef struct{ // div operands reply pkt
SINT32 result; // the result
}DOReply;
#if !defined(ENGINE)
//
// Following is the Client-Side API for divOperands
//
// DAPid - this is obtained from DAPInitialize. It is
// normally a pointer to some sort of structure
// containing info needed to connect to the server.
// op1 - the first operand to div
// op2 - the second operand to div
//
T_RC DAPDivideOperands(DAPDATA *DAPid,long op1, long op2, long *result)
{
T_RC rc;
DORequest *request = (DORequest *)DAPid->dapRequest.data;
DOReply *reply = (DOReply *)DAPid->dapReply.data;
//
// fill in the request structure
//
request->operand1 = op1;
request->operand2 = op2;
//
// Send the request
//
if( (rc = DAPSendRequest(DAPid,DAPDIVIDEOPERANDS)) == 0){
//
// Copy result
//
*result = reply->result;
}
return rc;
}
#else // !defined(ENGINE)
//
// Following is the Server-Side API for divOperands
//
void DAPDivideOperands(DAPDATA *DAPid)
{
DORequest *request = (DORequest *)DAPid->dapRequest.data;
DOReply *reply = (DOReply *)DAPid->dapReply.data;
DIAG4("Inside DivideOperands DAP");
//
// Do the work
//
if( request->operand2 != 0 ){
reply->result = request->operand1 / request->operand2;
DAPid->dapReply.returnCode = DAP_SUCCESS;
}
else{
reply->result = 0;
DAPid->dapReply.returnCode = DAP_DIVIDE_BY_ZERO;
}
//
// Now send the result to the client
//
DAPEnqueueServiceReply(DAPid);
}
#endif // !defined(ENGINE)